home *** CD-ROM | disk | FTP | other *** search
- ;
- ; Simple version of the C "sprintf" function. Assumes C-style
- ; stack-based function conventions.
- ;
- ; long eyecount;
- ; eyecount=2;
- ; sprintf(string,"%s have %ld eyes.","Fish",eyecount);
- ;
- ; would produce "Fish have 2 eyes." in the string buffer.
- ;
- xdef _myrawdofmt
- xdef @myrawdofmt
- xref _LVORawDoFmt
-
- SECTION myrawdofmt,CODE
-
- _myrawdofmt:
-
- movem.l a2/a3/a6,-(sp) ; save registers
-
- move.l $10(sp),a3 ; get destination buffer
- move.l $14(sp),a0 ; get format string
- move.l $18(sp),a1 ; get arguments
-
- lea stuffChar(pc),a2 ; get formatting routine
-
- move.l 4,a6
- jsr _LVORawDoFmt(a6)
-
- move.l $10(sp),d0
-
- movem.l (sp)+,a2/a3/a6 ; restore registers
-
- rts
-
- @myrawdofmt:
-
- ; myrawdofmt(buffer, template, args)
- ; a0 a1 a2
-
- movem.l a2/a3/a6,-(sp)
-
- ; NextData = RawDoFmt(FormatString, DataStream, PutChProc, PutChData);
- ; d0 a0 a1 a2 a3
-
- movea.l a0,a3
- movea.l a1,a0
- movea.l a2,a1
- lea.l stuffChar(pc),a2
-
- move.l 4,a6
- jsr _LVORawDoFmt(a6)
-
- movem.l (sp)+,a2/a3/a6
- move.l 4(sp),d0
-
- rts
-
- ;------ PutChProc function used by RawDoFmt -----------
-
- stuffChar:
-
- move.b d0,(a3)+
- rts
-
- END
-